//
//  LoginViewController.m
//  登录界面
//
//  Created by 刘波岐 on 16/9/1.
//  Copyright © 2016年 刘波岐. All rights reserved.
//

#import "LoginViewController.h"
#import <ShareSDK/ShareSDK.h>
#import <ShareSDKUI/ShareSDKUI.h>
#import "HomepageViewController.h"

@interface LoginViewController ()

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
- (IBAction)login:(id)sender {
    HomepageViewController *homepage = [[HomepageViewController alloc]init];

    [ShareSDK authorize:SSDKPlatformTypeSinaWeibo settings:nil onStateChanged:^(SSDKResponseState state, SSDKUser *user, NSError *error) {
//        self.label.text = user.nickname;
//        self.aboutMeLabel.text = user.aboutMe;
        homepage.iconStr = user.icon;
        homepage.nameStr = user.nickname;
        homepage.funsStr = [NSString stringWithFormat:@"%ld",user.followerCount];
        homepage.friendCount = [NSString stringWithFormat:@"%ld",user.friendCount];
        homepage.signStr = user.aboutMe;
        [self.navigationController pushViewController:homepage animated:YES];
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
